class VotesController < ApplicationController

  def vote
    @post = Post.find(params[:id]) if !params[:id].nil?
    @user = User.find(session[:user_id]) if !session[:user_id].nil?
    if !@post.nil? && !@user.nil?
      Vote.vote( @user.id, @post.id, ((params[:v] == 'p') ? 1 :-1) )
    end
    render :partial => "votes/post_score", :locals => { :post => @post }
  end


end
